using UnityEngine;
/**
Camera for third person
*/
public class MouseCamera : MonoBehaviour {
private bool revertFogState = false;

public Transform target; // Target object position
public LayerMask mask; // Layer(s) for interact with mouse click
public MousePerson player; // Player class
private Vector3 direction;// moving vector
RaycastHit hit; // Ray

void Update() {
if (Input.GetMouseButtonUp(0)) {
	// Get ray direction
	Ray ray = camera.ScreenPointToRay(Input.mousePosition);
	// Cast ray on infinity and checj for crossing layer(s)
	if (Physics.Raycast(ray, out hit, Mathf.Infinity, mask)) {
		// Set target position to ray hit point
		target.position = hit.point;

		// Set new target for player
		player.GetTarget(target.position);
		}
	}
}

void OnPreRender() {
    revertFogState = RenderSettings.fog;
    RenderSettings.fog = enabled;
}
void OnPostRender() {
    RenderSettings.fog = revertFogState;
}
}